package com.e_manager.soft.emanager.service.impl;

import com.e_manager.soft.emanager.entity.Equipment;
import com.e_manager.soft.emanager.idao.EquipmentDao;
import com.e_manager.soft.emanager.service.EquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * @author : lip[lip4051@163.com]
 * @create : 2018/3/22 0022 上午 10:25
 */
@Service
public class EquipmentServiceImpl implements EquipmentService {
    @Autowired
    private EquipmentDao equipmentDao;

    @Transactional
    @Override
    public void insertEquipment(Equipment equipment) {

        equipmentDao.insertEquipment(equipment);
    }

    @Transactional
    @Override
    public void updateEquipment(Equipment equipment) {
        equipmentDao.updateEquipment(equipment);
    }

    /**
     * 更新设备名称
     *
     * @param equipment
     */
    @Transactional
    @Override
    public void updateEquipmentName(Equipment equipment) {
        equipmentDao.updateEquipmentName(equipment);
    }

    @Transactional
    @Override
    public void deleteEquipment(Equipment equipment) {
        equipmentDao.deleteEquipment(equipment);
    }

    @Transactional
    @Override
    public void deleteEquipmentName(Equipment equipment) {
        equipmentDao.deleteEquipmentName(equipment);
    }

    @Override
    public Equipment getEquipmentById(String id) {
        return equipmentDao.getEquipmentById(id);
    }
}
